$(function () {
    $("#ub").datagrid({
        title: "所有用户列表",
        url: 'showAll/findAllUser',
        fitColumns: true,
        singleSelect: true,
        pagination:true,//分页属性
        columns: [[
            {field: 'username', title: '用户登录名', width: 100},
            {field: 'realname', title: '真实姓名', width: 100},
            {field: 'sex', title: '性别', width: 100},
            {field: 'cardType', title: '证件类型', width: 100}
    
        ]],
        view: detailview,
        detailFormatter: function (index, row) {
            if (!isNaN(row.departure_time)) {
                var Timestamp = new Date(row.departure_time);
                row.departure_time= Timestamp.toLocaleString();
            }
            if (!isNaN(row.arrival_time)) {
                var Timestamp = new Date(row.arrival_time);
                row.arrival_time= Timestamp.toLocaleString();
            }
            return '<div><table><tr>' +
                '<p>用户id: ' + row.id + '</p>' +
                '<p>用户登录名: ' + row.username + '</p>' +
                '<p>真实姓名: ' + row.realname + '</p>' +
                '<p>性别: ' + row.sex + '</p>' +
                '<p>证件类型: ' + row.cardtype + '</p>' +
                '<p>证件号码: ' + row.cardid + '</p>' +
                '<p>省份: ' + row.province + '</p>' +
                '<p>市县: ' + row.city + '</p>' +                                       
               '<p>用户类型: ' + row.type + '</p>' + 
                '</tr></table></div>';
        }
    });
});
